<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <title>统一数字开发底座-开发平台</title>
    <link rel="icon" href="/favicon.ico" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <style lang="less">
      .app-browser {
        width: 100%;
        height: 100%;
        position: absolute;
        overflow-x: hidden;
        overflow-y: hidden;
      }

      .background-image {
        position: relative;
        width: 100%;
        height: 100%;
        background-size: 100% 100%;
        background-repeat: no-repeat;
        background-image: url('/static/img/bg.png');
      }
      .main-modal {
        position: absolute; /* 设置垂直水平居中 */
        top: 0;
        bottom: 0;
        left: 0;
        right: 0;
        margin: 5%;
        width: 90%;
        height: 80%;
        opacity: 0.4;
        background-color: #fff;
        filter: alpha(opacity=60);
        border-radius: 10px;
        backdrop-filter: blur(5px); /* 设置模糊程度 */
      }
      .main-content {
        position: absolute;
        top: 10%;
        bottom: 10%;
        left: 5%;
        right: 5%;
        margin: auto;
      }
      .main-title {
        position: relative;
        width: 21%;
        margin: 2% auto 2%;
      }
      .IE-Compatibility-title {
        display: inline;
        position: absolute;
      }
      .main-title-img {
        width: 40px;
        height: 40px;
        margin-right: 10px;
      }
      .main-warn {
        margin: 2% auto 4%;
        background-color: red;
        filter: alpha(opacity=10);
        width: 91%;
        padding: 10px 0;
        border-radius: 10px;
        text-align: center;
      }
      .main-warn-img {
        width: 20px;
        height: 20px;
        margin-left: 10px;
        margin-right: 5px;
        position: relative;
        top: 4px;
      }
      .main-browsers li {
        list-style: none;
        float: left;
        margin: 0 2%;
      }
      .main-browsers {
        position: absolute;
        margin: 24px 5% 0;
        width: 91%;
        height: 80%;
      }
      .browser {
        position: relative;
        background-color: #fff;
        border-radius: 10px;
        border: 1px solid rgb(222, 225, 230);
        width: 21.8%;
        height: 68%;
      }
      .main-browsers-img {
        display: block;
        height: 31%;
        margin: 30% auto 10% auto;
      }
      .bold {
        text-align: center;
        display: block;
        font-weight: bold;
        font-size: 20px;
      }
    </style>
    <script>
      var baseurl = window.location.href;
      var host = window.location.host;
      // 页面初始化
      window.onload = function () {
        // 判断当前是否是IE浏览器
        if (!!window.ActiveXObject || 'ActiveXObject' in window) {
          // 截取跳转url
          var windowUrl = baseurl.substring(0, baseurl.indexOf('/public'));
          var chrome = document.getElementById('chrome');
          var edge = document.getElementById('edge');
          var qianxin = document.getElementById('qianxin');
          var firefox = document.getElementById('firefox');
          handleClickBrower(windowUrl);
        }
      };

      function handleClickBrower(windowUrl) {
        //绑定浏览器图标
        chrome.onclick = function () {
          openInNewBrowser(windowUrl, 'chrome');
        };
        edge.onclick = function () {
          openInNewBrowser(windowUrl, 'edge');
        };
        qianxin.onclick = function () {
          openInNewBrowser(windowUrl, 'qianxin');
        };
        firefox.onclick = function () {
          openInNewBrowser(windowUrl, 'firefox');
        };
      }
      function openInNewBrowser(windowUrl, browser) {
        var objShell = null;
        try {
          var objShell = new ActiveXObject('WScript.Shell');
        } catch (e) {
          alert('请将' + host + '添加可信站点并启用Active控件');
        }
        if (objShell) {
          if (browser === 'chrome') {
            try {
              var openUrl = 'chrome.exe "' + windowUrl;
              objShell.Run(openUrl);
              objShell = null;
              window.opener = null;
              window.open('', '_self', '');
              window.close();
            } catch (e) {
              try {
                var openUrl = '"C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe "' + windowUrl;
                objShell.Run(openUrl);
                objShell = null;
                window.opener = null;
                window.open('', '_self', '');
                window.close();
              } catch (e) {
                try {
                  var openUrl = '"C:\\Program Files (x86)\\Chrome\\chrome.exe "' + windowUrl;
                  objShell.Run(openUrl);
                  objShell = null;
                  window.opener = null;
                  window.open('', '_self', '');
                  window.close();
                } catch (e) {
                  alert('暂未找到该浏览器安装位置，请手动启动');
                }
              }
            }
          } else if (browser === 'edge') {
            try {
              var openUrl = 'msedge.exe "' + windowUrl;
              objShell.Run(openUrl);
              objShell = null;
              window.opener = null;
              window.open('', '_self', '');
              window.close();
            } catch (e) {
              try {
                var openUrl = '"C:\\Program Files\\Microsoft\\Edge\\Application\\msedge.exe "' + windowUrl;
                objShell.Run(openUrl);
                objShell = null;
                window.opener = null;
                window.open('', '_self', '');
                window.close();
              } catch (e) {
                try {
                  var openUrl = '"C:\\Program Files (x86)\\Microsoft\\Edge\\Application\\msedge.exe "' + windowUrl;
                  objShell.Run(openUrl);
                  objShell = null;
                  window.opener = null;
                  window.open('', '_self', '');
                  window.close();
                } catch (e) {
                  alert('暂未找到该浏览器安装位置，请手动启动');
                }
              }
            }
          } else if (browser === 'qianxin') {
            try {
              var openUrl = 'qaxbrowser.exe "' + windowUrl;
              objShell.Run(openUrl);
              objShell = null;
              window.opener = null;
              window.open('', '_self', '');
              window.close();
            } catch (e) {
              try {
                var openUrl = '"C:\\Program Files\\Qaxbrowser\\Application\\qaxbrowser.exe "' + windowUrl;
                objShell.Run(openUrl);
                objShell = null;
                window.opener = null;
                window.open('', '_self', '');
                window.close();
              } catch (e) {
                try {
                  var openUrl = '"C:\\Program Files (x86)\\Qaxbrowser\\Application\\qaxbrowser.exe "' + windowUrl;
                  objShell.Run(openUrl);
                  objShell = null;
                  window.opener = null;
                  window.open('', '_self', '');
                  window.close();
                } catch (e) {
                  alert('暂未找到该浏览器安装位置，请手动启动');
                }
              }
            }
          } else if (browser === 'firefox') {
            try {
              var openUrl = 'firefox.exe "' + windowUrl;
              objShell.Run(openUrl);
              objShell = null;
              window.opener = null;
              window.open('', '_self', '');
              window.close();
            } catch (e) {
              try {
                var openUrl = '"C:\\Program Files\\Mozilla Firefox\\firefox.exe "' + windowUrl;
                objShell.Run(openUrl);
                objShell = null;
                window.opener = null;
                window.open('', '_self', '');
                window.close();
              } catch (e) {
                try {
                  var openUrl = '"C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe "' + windowUrl;
                  objShell.Run(openUrl);
                  objShell = null;
                  window.opener = null;
                  window.open('', '_self', '');
                  window.close();
                } catch (e) {
                  alert('暂未找到该浏览器安装位置，请手动启动');
                }
              }
            }
          }
        }
      }
    </script>
  </head>

  <body>
    <div class="app-browser" id="browser-modal" style="position: absolute; left: 0; right: 0; top: 0; bottom: 0">
      <div id="main-container" class="background-image">
        <img src="../static/img/bg.png" style="width: 100%; position: relative; z-index: 0" />
        <div class="main-modal"></div>
        <div class="main-content">
          <div class="main-title">
            <img class="main-title-img" src="/static/img/logo.png" />
            <h1 class="IE-Compatibility-title">统一数字开发底座-开发平台</h1>
          </div>
          <div class="main-warn">
            <img class="main-warn-img" src="../static/img/information-fill.png" />
            <span style="position: relative">
              您正在使用的浏览器内核版本过低,
              <b style="color: #41adef; font-weight: normal; position: relative">已不再提供技术支持,</b>
              为避免可能存在的安全隐患,建议您在以下浏览器中登陆系统应用
            </span>
          </div>
          <div class="main-browsers">
            <li id="chrome" class="browser" style="margin-left: 0 !important">
              <img class="main-browsers-img" src="../static/img/chrome.png" />
              <span class="bold">Chrome 87+</span>
            </li>
            <li id="edge" class="browser">
              <img class="main-browsers-img" src="../static/img/edge.png" />
              <span class="bold">Edge 88+</span>
            </li>
            <li id="qianxin" class="browser">
              <img class="main-browsers-img" src="../static/img/qianxin.png" />
              <span class="bold">奇安信 V1.1+</span>
            </li>
            <li id="firefox" class="browser" style="margin-right: 0 !important">
              <img class="main-browsers-img" src="../static/img/firfox.png" />
              <span class="bold">Firefox 78+</span>
            </li>
          </div>
        </div>
      </div>
    </div>
    <script type="module" src="/src/main.ts"></script>
    <script src="/static/config.js?t=001"></script>
  </body>
</html>
